package fengstyle.sms;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 消费者，监听MQ,消费消息
 * 监听组：监听topic：监听tag（默认监听topic下所有）
 * 监听消费模式：默认负载均衡：CLUSTRRING（每个消息只发给一个消费者）、广播模式：BROADCASTING（发给所有消费者）
 */
@Component
@RocketMQMessageListener(topic = "sms-topic", consumerGroup = "${rocketmq.consumer.group}")
public class SmsConsumer implements RocketMQListener<String> {


    @Override
    public void onMessage(String s) {
        System.out.println("消费者监听到消息：" + s);
    }
}
